package com.explorati.design_pattern.behavior.visitor;

import java.util.ArrayList;
import java.util.List;

public class Test {

	public static void main(String[] args) {
		List<Course> courseList = new ArrayList<>();

		FreeCourse freeCourse = new FreeCourse();
		freeCourse.setName("SpringMVC数据绑定");

		CodingCourse codingCourse = new CodingCourse();
		codingCourse.setName("Java设计模式精讲");
		codingCourse.setPrice(299);

		courseList.add(freeCourse);
		courseList.add(codingCourse);

		for (Course course : courseList) {
			//对相同的数据产生不同的操作行为
			course.accept(new Visitor());
		}
	}
}
